public class Complex {
     private double re, im;
    
     // A normal parametrized constructor 
     public Complex(double re, double im) {
            this.re = re;
             this.im = im;
      }
    
     // copy constructor
     public  Complex(Complex c) {
         re = c.re;
         im = c.im;
     }
    
      public double getRealPart(){
    	  return re;
      }
    
      public double getImaginaryPart(){
            return im;
      }
    
      public void setRealPart(double re){
          this.re = re;
      }
    
      public void setImaginaryPart(double im){
         this.im = im;
      }
     
      // Overriding the toString of Object class
      public String toString() {
          return "(" + re + " + " + im + "i)";
      }

      // Overriding the equals method of Object class
      public boolean equals(Object obj){
          if(obj == null)
               return false;
          else if(getClass() != obj.getClass())
               return false;
          else{
              Complex  cmplx = (Complex) obj;
              return re == cmplx.re && im == cmplx.im;
          }
      }
}